package com.example.enigmacinema;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;

public class LvPreview extends Activity {

    AdView adView;
    private ImageView xImg01, xImg02, xImg03, xImg04, xImg05, xImg06;
    private int xLvPass;
    private int xImgPass;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.lvpreview);

        Bundle extras = getIntent().getExtras();
        int xLv = extras.getInt("lv");

        xImg01 = (ImageView) findViewById(R.id.imageView);
        xImg02 = (ImageView) findViewById(R.id.imageView2);
        xImg03 = (ImageView) findViewById(R.id.imageView3);
        xImg04 = (ImageView) findViewById(R.id.imageView4);
        xImg05 = (ImageView) findViewById(R.id.imageView5);
        xImg06 = (ImageView) findViewById(R.id.imageView6);

        switch (xLv) {
            case 01: {
                xLvPass = 1;
                xImg01.setImageResource(R.drawable.starwars);
                xImg02.setImageResource(R.drawable.labellaylabestia);
                xImg03.setImageResource(R.drawable.starwars);
                xImg04.setImageResource(R.drawable.starwars);
                xImg05.setImageResource(R.drawable.starwars);
                xImg06.setImageResource(R.drawable.starwars);
                break;
            }
            case 02: {
                xLvPass = 2;
                xImg01.setImageResource(R.drawable.starwars);
                xImg02.setImageResource(R.drawable.starwars);
                xImg03.setImageResource(R.drawable.starwars);
                xImg04.setImageResource(R.drawable.starwars);
                xImg05.setImageResource(R.drawable.starwars);
                xImg06.setImageResource(R.drawable.starwars);
                break;
            }
            case 03: {
                xLvPass = 3;
                xImg01.setImageResource(R.drawable.starwars);
                xImg02.setImageResource(R.drawable.starwars);
                xImg03.setImageResource(R.drawable.starwars);
                xImg04.setImageResource(R.drawable.starwars);
                xImg05.setImageResource(R.drawable.starwars);
                xImg06.setImageResource(R.drawable.starwars);
                break;
            }
            case 04: {
                xLvPass = 4;
                xImg01.setImageResource(R.drawable.starwars);
                xImg02.setImageResource(R.drawable.starwars);
                xImg03.setImageResource(R.drawable.starwars);
                xImg04.setImageResource(R.drawable.starwars);
                xImg05.setImageResource(R.drawable.starwars);
                xImg06.setImageResource(R.drawable.starwars);
                break;
            }
            case 05: {
                xLvPass = 5;
                xImg01.setImageResource(R.drawable.starwars);
                xImg02.setImageResource(R.drawable.starwars);
                xImg03.setImageResource(R.drawable.starwars);
                xImg04.setImageResource(R.drawable.starwars);
                xImg05.setImageResource(R.drawable.starwars);
                xImg06.setImageResource(R.drawable.starwars);
                break;
            }
            case 06: {
                xLvPass = 6;
                xImg01.setImageResource(R.drawable.starwars);
                xImg02.setImageResource(R.drawable.starwars);
                xImg03.setImageResource(R.drawable.starwars);
                xImg04.setImageResource(R.drawable.starwars);
                xImg05.setImageResource(R.drawable.starwars);
                xImg06.setImageResource(R.drawable.starwars);
                break;
            }
        }

        AdRequest adRequest = new AdRequest();

        adRequest.addTestDevice(AdRequest.TEST_EMULATOR);

        adRequest.addTestDevice("4G74FC73D62D42B62A7F7DA61EF5F776");

        adView = new AdView(this, AdSize.BANNER, MainMenu.MY_PUBLISHER_ID);

        LinearLayout adlayout = (LinearLayout) findViewById(R.id.adLayoutLv);

        adlayout.addView(adView);


        adView.loadAd(adRequest);
    }

    public void openImg01(View view) {
        Intent i = new Intent(this, ImgOpen.class);


        switch (xLvPass){
            case 1:{
                i.putExtra("img", 1);
                break;
            }
            case 2:{
                i.putExtra("img", 7);
                break;
            }
            case 3:{
                i.putExtra("img", 13);
                break;
            }
            case 4:{
                i.putExtra("img", 19);
                break;
            }
            case 5:{
                i.putExtra("img", 25);
                break;
            }
            case 6:{
                i.putExtra("img", 31);
                break;
            }
        }
        startActivity(i);
    }

    public void openImg02(View view) {
        Intent i = new Intent(this, ImgOpen.class);


        switch (xLvPass){
            case 1:{
                i.putExtra("img", 2);
                break;
            }
            case 2:{
                i.putExtra("img", 8);
                break;
            }
            case 3:{
                i.putExtra("img", 14);
                break;
            }
            case 4:{
                i.putExtra("img", 20);
                break;
            }
            case 5:{
                i.putExtra("img", 26);
                break;
            }
            case 6:{
                i.putExtra("img", 32);
                break;
            }
        }
        startActivity(i);
    }

    public void openImg03(View view) {
        Intent i = new Intent(this, ImgOpen.class);

        switch (xLvPass){
            case 1:{
                i.putExtra("img", 3);
                break;
            }
            case 2:{
                i.putExtra("img", 9);
                break;
            }
            case 3:{
                i.putExtra("img", 15);
                break;
            }
            case 4:{
                i.putExtra("img", 21);
                break;
            }
            case 5:{
                i.putExtra("img", 27);
                break;
            }
            case 6:{
                i.putExtra("img", 33);
                break;
            }
        }
        startActivity(i);
    }

    public void openImg04(View view) {
        Intent i = new Intent(this, ImgOpen.class);


        switch (xLvPass){
            case 1:{
                i.putExtra("img", 4);
                break;
            }
            case 2:{
                i.putExtra("img", 10);
                break;
            }
            case 3:{
                i.putExtra("img", 16);
                break;
            }
            case 4:{
                i.putExtra("img", 22);
                break;
            }
            case 5:{
                i.putExtra("img", 28);
                break;
            }
            case 6:{
                i.putExtra("img", 34);
                break;
            }
        }
        startActivity(i);
    }

    public void openImg05(View view) {
        Intent i = new Intent(this, ImgOpen.class);

        switch (xLvPass){
            case 1:{
                i.putExtra("img", 5);
                break;
            }
            case 2:{
                i.putExtra("img", 11);
                break;
            }
            case 3:{
                i.putExtra("img", 17);
                break;
            }
            case 4:{
                i.putExtra("img", 23);
                break;
            }
            case 5:{
                i.putExtra("img", 29);
                break;
            }
            case 6:{
                i.putExtra("img", 35);
                break;
            }

        }
        startActivity(i);
    }

    public void openImg06(View view) {
        Intent i = new Intent(this, ImgOpen.class);


        switch (xLvPass){
            case 1:{
                i.putExtra("img", 6);
                break;
            }
            case 2:{
                i.putExtra("img", 12);
                break;
            }
            case 3:{
                i.putExtra("img", 18);
                break;
            }
            case 4:{
                i.putExtra("img", 24);
                break;
            }
            case 5:{
                i.putExtra("img", 30);
                break;
            }
            case 6:{
                i.putExtra("img", 36);
                break;
            }
        }
        startActivity(i);
    }
}
